package net.lainiao.subpub;

import com.rabbitmq.client.Channel;
import net.lainiao.MyConst;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * Created by Administrator on 2018/7/9.
 */
public class ProviderDemo {
    public static void main(String[] args) throws IOException, TimeoutException, InterruptedException {
        final Channel channel = MyConst.getChanel();
        channel.exchangeDeclare(MyConst.EName2, "fanout");
        channel.queueDeclare(MyConst.QName21, false, false, true, null);
        channel.queueDeclare(MyConst.QName22, false, false, true, null);
        channel.queueBind(MyConst.QName21, MyConst.EName2, "");
        channel.queueBind(MyConst.QName22, MyConst.EName2, "");
        channel.basicPublish(MyConst.EName2,"",null,"有人注册了".getBytes());
        channel.close();
        MyConst.connection.close();
    }
}
